function custom_split(value, separator) {
	var splited = value.split(separator);

	if ( splited.length <= 1 ) {
		return value;
	} else {
		return splited;
	}
}


function custom_capitalize( str ) {
	var nstr = "";

	var str_mapped = $.map( str.split(" "), function(element, index) {

			if ( element.length > 3 ) {
				
				return element.capitalize();

			} else {
				
				return element;

			}

	} );

	for ( i = 0; i < str_mapped.length; i++ ) {

		nstr += str_mapped[ i ] + " ";

	}

	return nstr.trim();


}

function show_dialog(message) {
	
	if (message == "" || message == undefined) return false;

	var dialog = new goog.ui.Dialog();
	dialog.setContent(message);
	dialog.setTitle('Aviso: ');
	dialog.setButtonSet(goog.ui.Dialog.ButtonSet.OK);   
	dialog.setVisible(true);

}

function submit_via_post_to(address, data) {

	var message;

	$.ajax({

		async: false,
		url: address,
		data: data,
		success: function(m) {
			message = m;			
		}

	});

	return message;

}
